<%@ page language="java" contentType="text/html;  charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript" src="${ctx}/resources/jquery/jquery-1.8.1.min.js"></script>
<script type="text/javascript">
var timerAjax;
$(function(){
	$("#startAjax").click(function(){
		timerAjax = setInterval(function(){
			$.get("${ctx}/demo/ajax?t=" + new Date().getTime(), function(data){
				// TODO: ....
			});
		}, 2000);
	});
	$("#stopAjax").click(function(){
		clearInterval(timerAjax);
		$("#startAjax").removeAttr("disabled");
	});
});
</script>
</head>
<body style="margin:0px;padding:0px;">
	<input type="button" id="startAjax" value="开始执行" />
	<input type="button" id="stopAjax" value="停止执行" />
</body>
<html>